# Python空安全示例
def python_null_safety():
    # Python中的空安全处理
    nullable_string = None
    
    # 安全调用
    try:
        print(f"Python安全调用: {nullable_string.length}")
    except AttributeError as e:
        print(f"Python安全调用: {str(e)}")
    
    # 非空检查
    non_nullable_string = nullable_string if nullable_string is not None else "默认值"
    
    # 空值合并
    default_string = nullable_string or "默认值"
    print(f"Python空值合并: {default_string}")

if __name__ == "__main__":
    python_null_safety()